#!/usr/bin/env bash

dst_path="/data/local/tmp/"
tf_src_path="/Users/xuxu/Desktop/workspace/android_run_tflite/tensorflow"
#adb push lib ${dst_path}

#model="mobilenet_v2_1.0_224.tflite"
#model="02.tflite"
#model="08.tflite"
#model="unet_mbv2_05_104pts.tflite"
#model="AADB_HADB_MBV2_model_fp32.tflite"
model="model_normalize_object_scene_ps_20200519_f32.tflite"

#cd ../tensorflow && bazel build -c opt --config=android_arm64 tensorflow/lite/delegates/gpu/cl/kernels:conv_powervr_test && cd -
#rm -rf conv_powervr_test
#cp ../tensorflow/bazel-bin/tensorflow/lite/delegates/gpu/cl/kernels/conv_powervr_test .
#adb push conv_powervr_test ${dst_path}
#echo "cd ${dst_path} && ./conv_powervr_test" | adb shell

cd ${tf_src_path} && bazel build -c opt --config=android_arm64 tensorflow/lite/tools/benchmark:benchmark_model && cd -
cp ${tf_src_path}/bazel-bin/tensorflow/lite/tools/benchmark/benchmark_model .
adb push benchmark_model ${dst_path}
echo "cd ${dst_path} && ./benchmark_model --graph=${model} --num_threads=4 --num_runs=10 --use_gpu=true --gpu_backend=cl --gpu_precision_loss_allowed=false --gpu_experimental_enable_quant=true --enable_op_profiling=false" | adb shell
